package com.woniu51.message.listener;

import com.woniu.common.constant.UserConstants;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author 杨光
 * @date 2022年04月01日 16:19
 */
@Component
public class MessageListener {


    @RabbitListener(bindings = {
            @QueueBinding(
                    exchange = @Exchange(name = UserConstants.MQ_REGISTER_EXCHANGE,
                            type = ExchangeTypes.TOPIC),
                    value = @Queue(value = UserConstants.MQ_REGISTER_QUEUE, durable = "true"),
                    key = {UserConstants.MQ_REGISTER_ROUTING_KEY}
            )
    })
    public void receiveUpdateRedisMessage(Map<String,String> msg){

        System.out.println("cellphone="+msg.get(UserConstants.REGISTER_MSG_KEY_CELLPHONE));
        System.out.println("code="+msg.get(UserConstants.REGISTER_MSG_KEY_CODE));

        //调用短信的sdk方法发短信


    }
}
